package com.drg.center.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.drg.center.entity.DictDiagnosisMainPO;
import com.drg.center.mapper.DictDiagnosisMainMapper;
import com.guaike.core.mybatis.plugins.BaseDAO;
import org.springframework.stereotype.Repository;


@Repository
public class DictDiagnosisMainDAO extends BaseDAO<DictDiagnosisMainMapper, DictDiagnosisMainPO> {

    public DictDiagnosisMainPO findByMdcAndMain(String mdcCode, String diagnosisCode) {
        LambdaQueryWrapper<DictDiagnosisMainPO> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(DictDiagnosisMainPO::getMdcCode, mdcCode);
        queryWrapper.eq(DictDiagnosisMainPO::getDiagnosisCode, diagnosisCode);
        return getBaseMapper().selectOne(queryWrapper);
    }

    public DictDiagnosisMainPO findByMain(String diagnosisCode) {
        LambdaQueryWrapper<DictDiagnosisMainPO> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(DictDiagnosisMainPO::getDiagnosisCode, diagnosisCode);
        return getBaseMapper().selectOne(queryWrapper);
    }
}
